/**
 * Created by Administrator on 2017/4/24.
 */
let webpack = require('webpack');
let path = require('path');

let publicPath = 'http://localhost:3000/';
let hotMiddlewareScript = 'webpack-hot-middleware/client?reload=true';

let devConfig = {
    entry: {
        abc: ['./client/home', hotMiddlewareScript]
    },
    output: {
        filename: './[name]/bundle.js',
        path: path.resolve('./public'),
        publicPath: publicPath
    },
    devtool: 'source-map',
    module: {
        loaders: [
            {
                test:/\.js$/,
                loader:['babel-loader','jsx-loader'],
                exclude: /node_modules/
            },
            {
                test: /\.(png|jpg)$/,
                loader: 'file-loader?name=img/[hash:8].[name].[ext]'
            },
            {
              test:/\.css$/,
                loader:['style-loader', 'css-loader', 'resolve-url-loader']
            },
            {
                test: /\.jsx?$/,
                loader:['babel-loader'],
                exclude: /node_modules/
            }
        ]
    },
    // resolve: {
    //     extensions: ['', '.js', '.jsx', '.css', '.json'],
    // },
    plugins: [
        // new webpack.optimize.UglifyJsPlugin({
        //     compress: {
        //         warnings: false,
        //     },
        //     output: {
        //         comments: false,
        //     },
        // }),
        new webpack.HotModuleReplacementPlugin(),
        new webpack.NoEmitOnErrorsPlugin()
    ]
};

module.exports = devConfig;